package main

import "fmt"

func main() {
	var names = [3]string{"张三", "李四", "王五"}
	var ages = [3]int{23, 24, 25}

	// 索引取值
	fmt.Println(names[2])
	fmt.Println(ages[2])

	// 修改元素
	names[0] = "赵六"
	fmt.Println(names)

	// 切片取值
	fmt.Println(names[0:3])
	fmt.Println(names[0:])
	fmt.Println(names[:3])

	// 循环取值
	for i := 0; i < len(names); i++ {
		fmt.Println(i, names[i])
	}

	for k, v := range names {
		fmt.Println(k, v)
	}
}
